home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '91 / Hacks '91 / Makin' Copies / Source / SwapVolume.c < prev   
Encoding:
C/C++ Source or Header  |  1991-06-20  |  1.1 KB  |  49 lines  |  [TEXT/KAHL]

  1. /*SwapVolume is part of shell Written by and property of: Eric J. Hayes*/
  2. /*non-profit use of this library must be accompanyed by a credit to myself.*/
  3. /*sale of all or any part of this library or it's headers prohibited without*/
  4. /*written permission of myself*/
  5. /* ®1987-1991 Eric J. Hayes*/
  6.  
  7.  
  8. #pragma mark  PROTOS
  9.         OSErr SwapVolume(short,long,short*,long*);
  10.  
  11.  
  12.  
  13. OSErr SwapVolume(inVRefNum,inDirID,outVRefNum,outDirID)
  14.  short    inVRefNum;
  15.  long    inDirID;
  16.  short    *outVRefNum;
  17.  long    *outDirID;
  18.     {
  19.     OSErr        err;
  20.     ParmBlkPtr pb;
  21.     
  22.     pb = (ParmBlkPtr)NewPtrClear(sizeof(WDPBRec));
  23.     
  24.     if ( pb != nil )
  25.         {
  26.         ((WDPBPtr)pb)->ioCompletion = nil;
  27.         err = PBHGetVol((WDPBPtr)pb,FALSE);
  28.         
  29.         if ( err == noErr )
  30.             {
  31.             *outVRefNum = ((WDPBPtr)pb)->ioVRefNum;
  32.             *outDirID    = ((WDPBPtr)pb)->ioWDDirID;
  33.             
  34.             ((WDPBPtr)pb)->ioCompletion    = nil;
  35.             ((WDPBPtr)pb)->ioNamePtr        = nil;
  36.             ((WDPBPtr)pb)->ioVRefNum        = inVRefNum;
  37.             ((WDPBPtr)pb)->ioWDProcID        = nil;
  38.             ((WDPBPtr)pb)->ioWDVRefNum        = nil;
  39.             ((WDPBPtr)pb)->ioWDDirID        = inDirID;
  40.             
  41.             err = PBHSetVol((WDPBPtr)pb,FALSE);
  42.             }
  43.         
  44.         DisposPtr((Ptr)pb);
  45.         }
  46.             
  47.     return(err);
  48.     }
  49.